//
// Created by Kai Wang on 2023/12/28.
//
#include "order/order_status.h"

namespace Convert
{
void StringToOrderStatus(const std::string &str, OrderStatus &status)
{
    if(str == "INVALID")
    {
        status = OrderStatus::INVALID;
    }
    else if(str == "QUEUING")
    {
        status = OrderStatus::QUEUING;
    }
    else if(str == "CANCELLED")
    {
        status = OrderStatus::CANCELLED;
    }
    else if(str == "FINISHED")
    {
        status = OrderStatus::FINISHED;
    }
    else
    {
        status = OrderStatus::INVALID;
    }
}

void OrderStatusToString(const OrderStatus &status, std::string &str)
{
    switch(status)
    {
    case OrderStatus::INVALID:
        str = "INVALID";
        break;
    case OrderStatus::QUEUING:
        str = "QUEUING";
        break;
    case OrderStatus::CANCELLED:
        str = "CANCELLED";
        break;
    case OrderStatus::FINISHED:
        str = "FINISHED";
        break;
    default:
        str = "INVALID";
        break;
    }
}

std::string OrderStatusToString(const OrderStatus &status)
{
    std::string str;
    switch(status)
    {
    case OrderStatus::INVALID:
        str = "INVALID";
        break;
    case OrderStatus::QUEUING:
        str = "QUEUING";
        break;
    case OrderStatus::CANCELLED:
        str = "CANCELLED";
        break;
    case OrderStatus::FINISHED:
        str = "FINISHED";
        break;
    default:
        str = "INVALID";
        break;
    }
    return str;
}
}